import QtQuick 2.6
import "."
import ConvertData 1.0

Item{
    width: 740
    height: 580


    Rectangle {
        id:root
        width: 740
        height: 580
        x:0
        y:0

        border.color: "#dcdcdc"
        border.width: 0.5

        Platform.onShowDialog:{
            dialog.visible=true
            dialog.titleStr=title
            dialog.contentStr=content
        }

        FirstPage{
            id:config
            x:0
            y:0
            width:root.width
            height:root.height

            //            onMapConfigBtnClicked: {
            //                config.x=-root.width
            //                convert.x=0;
            //            }

            //            onBackBtnClicked: {
            //                convert.x=0
            //                config.x=root.width;
            //            }

        }

//        Convert{
//            id:convert
//            x:root.width
//            y:0

//            width:root.width
//            height:root.height

//            onBackBtnClicked: {
//                config.x=0
//                convert.x=root.width;
//            }


//        }


        MouseArea {
            id: dragRegion
            anchors{
                left:parent.left
                top:parent.top
                right:parent.right
                rightMargin: 50
                leftMargin: 50
            }
            height:parent.height/18
            property point clickPos: "0,0"
            onPressed: {
                clickPos  = Qt.point(mouse.x,mouse.y)
            }
            onPositionChanged: {
                //鼠标偏移量
                var delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y)
                //如果mainwindow继承自QWidget,用setPos
                mainwindow.setX(mainwindow.x+delta.x)
                mainwindow.setY(mainwindow.y+delta.y)
            }
        }
    }

    Rectangle{
       id:dialog
       color:"transparent"
       property string titleStr:""
       property string contentStr:""
       visible: false
       anchors.fill: parent
       clip:true
       Rectangle{
           id:dialogRect

           border.color: View.mainColor
           border.width: 1

           anchors.centerIn: dialog
           color:"white"
           width:350
           height:150

           Rectangle{
               id:title
               anchors{
                   left:parent.left
                   top:parent.top
                   right:parent.right
               }
               height:28
               color:View.mainColor
               clip:true
               Text{
                   anchors{
                       fill:parent
                       leftMargin: 10

                   }
                   clip:true
                   horizontalAlignment: Text.AlignLeft
                   verticalAlignment: Text.AlignVCenter
                   color:"white"
                   font.family: View.mainFontFamily
                   font.pointSize: View.mainFontSize
                   text:dialog.titleStr
               }
           }

           Text{
               id:contentText
               anchors{
                   fill:parent
                   topMargin: 30
                   bottomMargin: 30
                   leftMargin: 10
                   rightMargin: 10

               }
               horizontalAlignment: Text.AlignHCenter
               verticalAlignment: Text.AlignVCenter
               color:View.mainColor
               font.family: View.mainFontFamily
               font.pointSize: View.mainFontSize
               text:dialog.contentStr
               clip:true
               wrapMode: Text.NoWrap
           }

           Item{
               anchors{
                   right:parent.right
                   bottom:parent.bottom
                   rightMargin: 20
                   bottomMargin: 20
               }
               width: 60
               height: 25
               ConvertButton{
                   anchors.fill: parent

                   text:"确定"
                   onClicked: {
                       dialog.visible=false
                   }
               }
           }

       }

       MouseArea{
           z:dialogRect.z-1
          anchors.fill: parent
          onClicked: {

          }
       }
    }
}

